package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
/**
 * Controller class for the DVD collection
 * 
 * @author (Gruppe B) 
 * @version 1.0(9-11-2013)
 */
public class DVDCtr
{
    private DVDContainer DVDCont;

    /**
     * This is the constructor for the DVD controller class. When called it calls the singleton method in the DVD Container class.
     */
    public DVDCtr()
    {
        DVDCont = DVDCont.getInstance(); 
    }

    /**
     * This method calls the read DVD method from the DVD Container class, and uses a string as search parameter.
     */
    public void getDVD(String title)
    {
        DVDCont.readDVD(title); 
    }

    /**
     * This method creates a new DVD with and takes input to define the fields of the new DVD, after being created it adds the new DVD to the Array List in the DVD container class.
     */
    public void createDVD(String title, String genre, String releaseDate, String language, String subtitle, double playTime, int copy)
    {       
        DVD dvd = new DVD(title, genre, releaseDate, language, subtitle, playTime, copy);
        DVDCont.addDVD(dvd);
    }

    
    /**
     * This method calls the delete DVD method in the DVD container class. Uses a search string.
     */
    public void deleteDVD(String title)
    {
        DVDCont.deleteDVD(title);
    }

    /**
     * This method calls the update Copy method in the DVD container class. Uses several inputs to define the new information about the DVD.
     */
    public void updateCopy(String title, String newTitle, String genre, String releaseDate, String language, String subtitle, double playTime, int copy)
    {
        DVDCont.updateDVD(title, newTitle, genre, releaseDate, language, subtitle, playTime, copy);
    }
    
    /**
     * This method calls the print method from the DVD container class. Which then prints out the information about all the DVDs in the array list.
     */
    public void listAllDVDs()
    {
        DVDCont.listDVDs();
    }
    
    /**
     * This method calls the set number of copies method in the DVD container. Uses a search string and then updates the copy field.
     */
    public void setNoOfCopies(String title, int copy)
    {
        DVDCont.setNoOfCopies(title, copy);
    }
}
